package ev.traffic;

import ev.agent.*;
import ev.space.*;
import ev.dao.DAOFactory;
import ev.dao.IDAO;
import java.util.List;

public class LineDecision{
	public static final IDAO dao = DAOFactory.getIDAOInstance();
	public static List<Integer> getRoadLine(int startpoint,int endpoint) {
			List<Integer> roadLine = dao.findPathByNodes(startpoint,endpoint);
			return roadLine;
	}
	public static void sort(int startpoint){
			List<Path> list = dao.findAll(startpoint);
			for(Path p:list){
					int end = p.getEnd();
					int weight = p.getLength();
					List<Nodes> nodeMap = CitySpace.nodeMap;
					Nodes temp = nodeMap.get(end);
					if(temp.getSub() != null){
							Substation sub = temp.getSub();
							sub.setDistance(weight);
					}
			}
	}
	public static int getLength(int start,int end){
			return dao.findLengthByNodes(start,end);
	}
		public static void main(String[] args){
		}
	}
